package com.telit.common.util;

import com.aliyuncs.exceptions.ClientException;
import com.telit.common.service.AliSmsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


/**
 * @Auther amy
 * @Describe aliyun 发送短信接口
 */
@Component
public class AliSmsUtils {

    private static AliSmsService aliSmsService;

    @Autowired
    public AliSmsUtils(AliSmsService aliSmsService){
        AliSmsUtils.aliSmsService = aliSmsService;
    }

    /**
     * @param mobile 手机号
     * @param params 参数,JSONObject.toJSONString(map),参数可以用map添加
     * @param smsTemplate 模板
     * @throws ClientException
     */
    public static void sendSms(String mobile, String params,String smsTemplate) throws ClientException {
        aliSmsService.sendSms(mobile,params,smsTemplate);
    }
}
